﻿@model TbShop.Web.Areas.Admin.Models.BannerViewModel
@{
    var opt = Model == null || Model.Id <= 0 ? "新增" : "修改";
    var moduleName = ViewBag.ModuleName;
    var controllerName = ViewBag.ControllerName as string;
    ViewBag.Title = opt + moduleName;
}
<div class="box box-primary">
   
    @using (Html.BeginForm("Edit", controllerName, FormMethod.Post, new { @enctype = "multipart/form-data", @validate = "" }))
    {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary()
        @Html.HiddenFor(model => model.Id)
        @Html.HiddenFor(model => model.CreatedBy)
        @Html.HiddenFor(model => model.CreatedDate)
        @Html.HiddenFor(model => model.VersionNumber)
        <div class="box-body">
            <div class="form-group">
                <label><strong class="notes">*</strong>Banner图片</label>
                @if (!string.IsNullOrWhiteSpace(Model.ImageUrl))
                {
                    <br />
                    <a href="javascript:void(0)" onclick="show_mainImageUrl(this)" fullpath="@Model.ImageUrl">
                        <img src="@Model.ImageUrl" width="200" />
                    </a>
                    <br />
                    <br />
                }
                <input type="file" name="image" accept="image/x-png,image/jpeg,image/x-ms-bmp" />
                @Html.HiddenFor(model => model.ImageUrl)
            </div>
            <div class="form-group">
                <label for="CategoryId"><strong class="notes">*</strong>位置</label>
                @Html.DropDownListFor(model => model.Category, Model.Categorys, new { @class = "form-control", @validate = "", @placeholder = "位置" })
            </div>

            <div class="form-group">
                <label for="ActiveId"><strong class="notes">*</strong>序号</label>
                @Html.TextBoxFor(model => model.Sort, new { @class = "form-control", @type = "number", @validate = "", @notranslator = "Sort" })
            </div>

            <div class="form-group">
                <label for="Url"><strong class="notes"></strong>链接</label>
                @Html.TextBoxFor(model => model.Url, new { @class = "form-control", @placeholder = "链接" })
                <p class="form-tip">以http://开头</p>
            </div>
            <div class="box-footer">
                <button type="submit" class="btn btn-primary">保存</button>
                <a href="@(Url.Action("Index"))" class="btn btn-default">返回</a>
            </div>
        </div>
    }
</div>
